home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / c / ExtrasLib.lha / ExtrasLib / Source / Misc.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-30  |  1.5 KB  |  75 lines

  1. #define __USE_SYSBASE
  2. #include <proto/exec.h>
  3. #include <proto/intuition.h>
  4. #include <proto/commodities.h>
  5. #include <proto/gadtools.h>
  6. #include <proto/graphics.h>
  7. #include <proto/utility.h>
  8. #include <proto/diskfont.h>
  9. #include <intuition/intuitionbase.h>
  10. #include <intuition/gadgetclass.h>
  11. #include <string.h>
  12. #include <stdlib.h>
  13. #include <math.h>
  14. #include <clib/extras_protos.h>
  15.  
  16.  
  17.  
  18. /****** extras.lib/AddHotKey ******************************************
  19. *
  20. *   NAME
  21. *       AddHotKey -- Add a hotkey to a Broker.
  22. *
  23. *   SYNOPSIS
  24. *       cxobj = AddHotKey(Broker,BrokerPort,HotKey,ID)
  25. *
  26. *       CxObj *AddHotKey(CxObj *,struct MsgPort *,STRPTR,ULONG)
  27. *
  28. *   FUNCTION
  29. *       Creates a hotkey for a broker.
  30. *
  31. *   INPUTS
  32. *       Broker     - Broker CxObj to attach hotkey to. 
  33. *       BrokerPort - Broker's MsgPort.
  34. *       HotKey     - Null terminated string.
  35. *       ID         - Hot keys ID. 
  36. *       
  37. *   RESULT
  38. *       pointer to a CxObj.
  39. *
  40. *   EXAMPLE
  41. *
  42. *   NOTES
  43. *    requires commodities.library to be opened. 
  44. *     commodities library already has HotKey()
  45. *
  46. *   BUGS
  47. *
  48. *   SEE ALSO
  49. *
  50. ******************************************************************************
  51. *
  52. */
  53.  
  54.  
  55. CxObj *AddHotKey(CxObj *Broker,struct MsgPort *BrokerPort,UBYTE *HotKey,ULONG ID)
  56. {
  57.   CxObj *f, *s, *t;
  58.  
  59.   if(f=CxFilter(HotKey))
  60.   {
  61.     AttachCxObj(Broker,f);
  62.     if(s=CxSender(BrokerPort,ID))
  63.     {
  64.       AttachCxObj(f,s);
  65.       if(t=CxTranslate(NULL))
  66.       {
  67.         AttachCxObj(f,t);
  68.         if(!CxObjError(f)) return(f);
  69.       }
  70.     }
  71.   }
  72.   if(f) DeleteCxObjAll(f);
  73.   return(NULL);
  74. }
  75.